<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/LICENSE-M1.txt
 *
 * @category   AW
 * @package    AW_Mobile
 * @copyright  Copyright (c) 2010-2011 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
 */
?>
var isGiftCardApplied = <?php if($this->isFullyPaidAfterApplication()): ?>true<?php else: ?>false<?php endif; ?>;
if (quoteBaseGrandTotal < 0.0001 && isGiftCardApplied) {
    Payment.prototype.init = function () {
        var elements = Form.getElements(this.form);
        var method = null;
        for (var i=0; i < elements.length; i++) {
            if (elements[i].name == 'payment[method]' && elements[i].value == 'free') {
                elements[i].checked = true;
                method = 'free';
            } else {
                $((elements[i]).parentNode).hide();
            }
        }
        if (method) this.switchMethod(method);
    };
}
